home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / boot / ConsoleFix.readme < prev    next >
Text File  |  1999-03-02  |  3KB  |  94 lines

  1. Short:    Fix a bug in the console.device
  2. Author:   thor@math.tu-berlin.de (Thomas Richter)
  3. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  4. Version:  1.00
  5. Type:     util/boot
  6. Requires: Os 3.0 (V39) or better
  7.  
  8. Purpose of this program:
  9.  
  10. This little patch fixes possible crashes of the console.device task, which,
  11. luckely, do not show up under "normal" circumstances. However, as soon as
  12. the console.device supervisor task takes more stack than usual, or this
  13. stack is filled by more than just zeros, the console device will crash on
  14. window resizes.
  15.  
  16. The reason for this crash is that the console.device main task uses a
  17. faulty algorithm to traverse an exec style list: The list header is
  18. also processed as a "node". Due to some lucky coincidences, the only data
  19. that gets querried by this faulty node is on the stack of the console device,
  20. and again due to some coincidence, this points to an area of the stack which
  21. is usually set to zero. All provided the stack of the console.device doesn't 
  22. grow too much.
  23.  
  24. For the experts: 
  25.  
  26.     The main loop of the console device looks like this:
  27.  
  28.     lea WindowList(a6),a2        ;get the head of the window list
  29. .loop:
  30.     bsr ProcessWindow        ;re-calcutes the window on a resize
  31.  
  32.     move.l (a2),a2            ;get next node
  33.     tst.l (a2)            ;end of list?
  34.     bne.s .loop
  35.  
  36. Hence, the list header is processed as a first node. Urgh!
  37.  
  38.  
  39. The correct method would have been:
  40.  
  41.  
  42.     lea WindowList(a6),a2        ;get the head of the window list
  43.     bra.s .into
  44. .loop:
  45.     bsr ProcessWindow        ;re-calcutes the window on a resize
  46. .into:
  47.     move.l (a2),a2            ;get next node
  48.     tst.l (a2)            ;end of list?
  49.     bne.s .loop
  50.  
  51.  
  52. This program fixes this bug by "hacking in" a new main loop for the console
  53. device, the source code is included.
  54.  
  55. I'm sorry for the uglyness of this patch, it was designed at 2 a.m. in the
  56. night and I was all than awake. It currently works like it is, but I'd really
  57. prefer if someone could write a "nicer" fix, or if AI would include this fix
  58. in the "SetPatch" program.
  59.  
  60. _____________________________________________________________________________
  61.  
  62. Credits:
  63.  
  64. Thanks goes to Nils Goers and his StackSnoop program. This console.device
  65. problem showed up while Nils was beta-testing his program, and I was
  66. curious what could have caused the crash. Stack-Snoop fills the application
  67. stack with a "magic cookie" to find out the true stack size a program re-
  68. quires, and this magic cookie caused the buggy code above to get mad.
  69. Always interested in the true reason for a crash, I found the above bug...
  70.  
  71. _____________________________________________________________________________
  72.  
  73. Copyright:
  74.  
  75.     None, this is freeware, public domain. Do whatever you want to do
  76.     with it.
  77.  
  78. _____________________________________________________________________________
  79.  
  80.  
  81. Thomas,
  82.     January 1999
  83.  
  84.  
  85. ============================= Archive contents =============================
  86.  
  87. Original  Packed Ratio    Date     Time    Name
  88. -------- ------- ----- --------- --------  -------------
  89.      596     471 20.9% 07-Jan-99 14:42:04 +ConsoleFix
  90.     6118    1570 74.3% 07-Jan-99 15:01:20 +ConsoleFix.asm
  91.     2767    1209 56.3% 07-Jan-99 14:59:22 +ConsoleFix.readme
  92. -------- ------- ----- --------- --------
  93.     9481    3250 65.7% 11-Jan-99 13:00:56   3 files
  94.